package com.zeng.springboot03web.controller;

import com.zeng.springboot03web.Mapper.DepartmentMapper;
import com.zeng.springboot03web.pojo.Books;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DepartmentController {
    @Autowired
    DepartmentMapper departmentMapper;

    @GetMapping("/getDepartments")
    public List<Books> getDepartments(){
        return departmentMapper.getDepartments();
    }

    @GetMapping("/getDepartment/{id}")
    public Books getDepartment(@PathVariable("id") int id){
        return departmentMapper.getDepartment(id);
    }
}
